package com.mbiolance.cloud.activiti.rpc;


import com.mbiolance.cloud.activiti.domain.dto.ProcessInstanceDto;
import com.mbiolance.cloud.activiti.domain.vo.StartProcessVo;
import com.mbiolance.cloud.auth.domain.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

@FeignClient(contextId = "ProcessInstance", value = "mbiolance-service-activiti", path = "/process-instance"
        , configuration = FeignConfiguration.class)
public interface ProcessInstanceFeignService {

    @ApiOperation("启动一个流程")
    @PostMapping("start")
    R<String> start(@RequestBody StartProcessVo vo);

    @ApiOperation("任务拾取")
    @PostMapping("claim/{id}")
    R<Boolean> claim(String id);

    @ApiOperation("任务退回")
    @PostMapping("ret-task/{id}")
    R<Boolean> retTask(String id);

    @ApiOperation("完成任务")
    @PostMapping("complete-task/{id}")
    R<Void> completeTask(@PathVariable String id, @RequestBody(required = false) Map<String, Object> variables);

    @ApiOperation("根据流程实例id列表获取实例信息")
    @PostMapping("list-ids")
    R<List<ProcessInstanceDto>> listByIds(@RequestBody List<String> processInstanceIds);

}
